﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="RecipeByTag.aspx.vb" Inherits="mybaconrecipe.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>
        Recipes Tagged <asp:Label ID="lbl_TAG" runat="server" CssClass="searchPhraseStyle"></asp:Label>
    </h1>

    <div id="lhsPaneWide">
        <asp:ListView ID="lstRecByTag" runat="server" 
            DataSourceID="RecByTagSqlDataSource">
            <AlternatingItemTemplate>
                <div class="recList_RecContainer">
                    <div class="recListHeading">
                        <a href='<%# DataBinder.Eval(Container.DataItem, "REC_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <%# DataBinder.Eval(Container.DataItem, "REC_NAME") %></a>
                    </div>
                    <div class="recListImgContainer">
                        <a href='<%# DataBinder.Eval(Container.DataItem, "REC_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <asp:Image ID="RecListImage" runat="server" ImageUrl='<%# Eval("REC_IMAGE") %>' CssClass="RecListThumb" /></a>
                    </div>
                    <div class="recListDetContainer">
                        <asp:Image ID="RecListStarsImage" runat="server" ImageUrl='<%# getBaconStars(Eval("REC_STARS"))%>'
                            ToolTip='<%# "Rated: " & DataBinder.Eval(Container.DataItem, "REC_STARS") & " Bacon Strips" %>' />
                        <div class="recListTimeServesCont">
                            Prep Time:
                            <asp:Label ID="REC_TIMELabel" runat="server" Text='<%# Eval("REC_TIME") %>' />
                            mins | Serves:
                            <asp:Label ID="REC_SERVESLabel" runat="server" Text='<%# Eval("REC_SERVES") %>' />
                        </div>
                        <div class="recListDescCont">
                            <asp:Label ID="REC_DESCLabel" runat="server" Text='<%# Eval("REC_DESC") %>' />
                        </div>
                    </div>
                </div>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                <div class="recList_RecContainer">
                    <div class="recListHeading">
                        <a href='<%# DataBinder.Eval(Container.DataItem, "REC_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <%# DataBinder.Eval(Container.DataItem, "REC_NAME") %></a>
                    </div>
                    <div class="recListImgContainer">
                        <a href='<%# DataBinder.Eval(Container.DataItem, "REC_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <asp:Image ID="RecListImage" runat="server" ImageUrl='<%# Eval("REC_IMAGE") %>' CssClass="RecListThumb" /></a>
                    </div>
                    <div class="recListDetContainer">
                        <asp:Image ID="RecListStarsImage" runat="server" ImageUrl='<%# getBaconStars(Eval("REC_STARS"))%>'
                            ToolTip='<%# "Rated: " & DataBinder.Eval(Container.DataItem, "REC_STARS") & " Bacon Strips" %>' />
                        <div class="recListTimeServesCont">
                            Prep Time:
                            <asp:Label ID="REC_TIMELabel" runat="server" Text='<%# Eval("REC_TIME") %>' />
                            mins | Serves:
                            <asp:Label ID="REC_SERVESLabel" runat="server" Text='<%# Eval("REC_SERVES") %>' />
                        </div>
                        <div class="recListDescCont">
                            <asp:Label ID="REC_DESCLabel" runat="server" Text='<%# Eval("REC_DESC") %>' />
                        </div>
                    </div>
                </div>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <span>No data was returned.</span>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <div class="recList_RecContainer">
                    <div class="recListHeading">
                        <a href='<%# DataBinder.Eval(Container.DataItem, "REC_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <%# DataBinder.Eval(Container.DataItem, "REC_NAME") %></a>
                    </div>
                    <div class="recListImgContainer">
                        <a href='<%# DataBinder.Eval(Container.DataItem, "REC_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <asp:Image ID="RecListImage" runat="server" ImageUrl='<%# Eval("REC_IMAGE") %>' CssClass="RecListThumb" /></a>
                    </div>
                    <div class="recListDetContainer">
                        <asp:Image ID="RecListStarsImage" runat="server" ImageUrl='<%# getBaconStars(Eval("REC_STARS"))%>'
                            ToolTip='<%# "Rated: " & DataBinder.Eval(Container.DataItem, "REC_STARS") & " Bacon Strips" %>' />
                        <div class="recListTimeServesCont">
                            Prep Time:
                            <asp:Label ID="REC_TIMELabel" runat="server" Text='<%# Eval("REC_TIME") %>' />
                            mins | Serves:
                            <asp:Label ID="REC_SERVESLabel" runat="server" Text='<%# Eval("REC_SERVES") %>' />
                        </div>
                        <div class="recListDescCont">
                            <asp:Label ID="REC_DESCLabel" runat="server" Text='<%# Eval("REC_DESC") %>' />
                        </div>
                    </div>
                </div>
            </InsertItemTemplate>
            <ItemTemplate>
                <div class="recList_RecContainer">
                    <div class="recListHeading">
                        <a href='<%# DataBinder.Eval(Container.DataItem, "REC_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <%# DataBinder.Eval(Container.DataItem, "REC_NAME") %></a>
                    </div>
                    <div class="recListImgContainer">
                        <a href='<%# DataBinder.Eval(Container.DataItem, "REC_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <asp:Image ID="RecListImage" runat="server" ImageUrl='<%# Eval("REC_IMAGE") %>' CssClass="RecListThumb" /></a>
                    </div>
                    <div class="recListDetContainer">
                        <asp:Image ID="RecListStarsImage" runat="server" ImageUrl='<%# getBaconStars(Eval("REC_STARS"))%>'
                            ToolTip='<%# "Rated: " & DataBinder.Eval(Container.DataItem, "REC_STARS") & " Bacon Strips" %>' />
                        <div class="recListTimeServesCont">
                            Prep Time:
                            <asp:Label ID="REC_TIMELabel" runat="server" Text='<%# Eval("REC_TIME") %>' />
                            mins | Serves:
                            <asp:Label ID="REC_SERVESLabel" runat="server" Text='<%# Eval("REC_SERVES") %>' />
                        </div>
                        <div class="recListDescCont">
                            <asp:Label ID="REC_DESCLabel" runat="server" Text='<%# Eval("REC_DESC") %>' />
                        </div>
                    </div>
                </div>
            </ItemTemplate>
            <LayoutTemplate>
                <div ID="itemPlaceholderContainer" runat="server" style="">
                    <span runat="server" id="itemPlaceholder" />
                </div>
                <div style="">
                </div>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <div class="recList_RecContainer">
                    <div class="recListHeading">
                        <a href='<%# DataBinder.Eval(Container.DataItem, "REC_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <%# DataBinder.Eval(Container.DataItem, "REC_NAME") %></a>
                    </div>
                    <div class="recListImgContainer">
                        <a href='<%# DataBinder.Eval(Container.DataItem, "REC_ID", "RecipeDetail.aspx?ID={0}") %>'>
                            <asp:Image ID="RecListImage" runat="server" ImageUrl='<%# Eval("REC_IMAGE") %>' CssClass="RecListThumb" /></a>
                    </div>
                    <div class="recListDetContainer">
                        <asp:Image ID="RecListStarsImage" runat="server" ImageUrl='<%# getBaconStars(Eval("REC_STARS"))%>'
                            ToolTip='<%# "Rated: " & DataBinder.Eval(Container.DataItem, "REC_STARS") & " Bacon Strips" %>' />
                        <div class="recListTimeServesCont">
                            Prep Time:
                            <asp:Label ID="REC_TIMELabel" runat="server" Text='<%# Eval("REC_TIME") %>' />
                            mins | Serves:
                            <asp:Label ID="REC_SERVESLabel" runat="server" Text='<%# Eval("REC_SERVES") %>' />
                        </div>
                        <div class="recListDescCont">
                            <asp:Label ID="REC_DESCLabel" runat="server" Text='<%# Eval("REC_DESC") %>' />
                        </div>
                    </div>
                </div>
            </SelectedItemTemplate>
        </asp:ListView>
    
        <asp:SqlDataSource ID="RecByTagSqlDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" 
            SelectCommand="SELECT * FROM [RECIPE_TAG_TAGNAME_VIEW] WHERE ([TAG] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="TAG" QueryStringField="Tag" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    
    </div>

    <div id="rhsPaneNarrow">
        <div class="adContainer">
            <div class="icnContainer">
                <img src="/ui/icnRSSFeed.gif" /></div>
            <div class="txtContainer">
                <p class="headerCont">
                    Never Miss A Greasy Recipe!</p>
                <p class="normalCont">
                    <a href="/RSS.aspx">Subscribe To Our RSS Feed!</a></p>
            </div>
        </div>
        <div class="sideBarList">
            <div class="sideImage">
                <img src="/ui/imgSideBacon.jpg" />
            </div>
            <div class="sideBarHeader">
                <h2>
                    Our Most Viewed Recipes<br />
                    <span>...all bursting with Bacon Goodness!</span></h2>
            </div>
            <asp:GridView ID="grd_sideTopRecipesViewed" runat="server" AutoGenerateColumns="False"
                DataSourceID="statRecipeNumViewsSqlDataSource" CssClass="grd_profileRecipeStyle"
                AllowPaging="False">
                <Columns>
                    <asp:TemplateField HeaderText="Record Number">
                        <ItemTemplate>
                            <%# Container.DataItemIndex + 1 %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Recipe">
                        <ItemTemplate>
                            <div>
                                <a href='<%# DataBinder.Eval(Container.DataItem, "RECIPE_ID", "RecipeDetail.aspx?ID={0}") %>'>
                                    <%# DataBinder.Eval(Container.DataItem, "REC_NAME") %></a></div>
                        </ItemTemplate>
                        <ControlStyle CssClass="EightyWidth" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle CssClass="notVis" />
            </asp:GridView>
            <asp:SqlDataSource ID="statRecipeNumViewsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT TOP 10 * FROM [STAT_RECIPE_NUMVIEWS_VIEW]">
            </asp:SqlDataSource>
        </div>
        <div class="sideBarList">
            <div class="sideImage">
                <img src="/ui/icnBaconLove.jpg" style="margin-left:20px;" />
            </div>
            <div class="sideBarHeader">
                <h2>
                    Our Top 5 Contributors<br />
                    <span>...sharing Bacon Love!</span></h2>
            </div>
            <asp:GridView ID="grd_StatTopUsersRecipes" runat="server" AutoGenerateColumns="False"
                DataSourceID="StatUserNumRecipesSqlDataSource" CssClass="grd_profileRecipeStyle"
                AllowPaging="True">
                <Columns>
                    <asp:TemplateField HeaderText="Record Number">
                        <ItemTemplate>
                            <%# Container.DataItemIndex + 1 %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="User">
                        <ItemTemplate>
                            <div style="width: 200px;">
                                <a href='<%# DataBinder.Eval(Container.DataItem, "USER_UNAME", "Profile.aspx?User={0}") %>'>
                                    <%# DataBinder.Eval(Container.DataItem, "USER_FNAME")%>
                                    <%# DataBinder.Eval(Container.DataItem, "USER_LNAME")%></a></div>
                        </ItemTemplate>
                        <ControlStyle CssClass="EightyWidth" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="User">
                        <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "NumRecipes") & " recipes" %>
                        </ItemTemplate>
                        <ControlStyle CssClass="EightyWidth" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle CssClass="notVis" />
            </asp:GridView>
            <asp:SqlDataSource ID="StatUserNumRecipesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:recipeConnectionString %>"
                ProviderName="<%$ ConnectionStrings:recipeConnectionString.ProviderName %>" SelectCommand="SELECT TOP 5 * FROM [NUM_RECIPE_VIEW]">
            </asp:SqlDataSource>
        </div>
    </div>
</asp:Content>
